package com.whately.core.base.constant;


import lombok.Data;
import lombok.ToString;

import java.io.Serializable;

/**
 *
 登录用户信息，有可能是个人1，有能是雇主2，有能是后台3

 */
@Data
@ToString
public class LoginUser implements Serializable {

    /**
     * 序列化id
     */
    private static final long serialVersionUID = 4125096758372084309L;

    //加密后的key
    private String encodeId;

    //可能是cid 或者uid
    private String userId;

    //用户账号
    private String userAccountNo;

    //用户类型
    private Integer userType;

    //姓名
    private String userName;

    //版本号信息，一般用update_time
    private Long userVersion;

    //机构id
    private Long organId;

    public void setUserIdNumber(Long userId) {
        this.userId = String.valueOf(userId);
    }

    public Long getUserIdNumber(){
        if(userId!=null){
            return Long.parseLong(userId);
        }
        return null;
    }

    public String uniquePk(){
        if(userType==null){
            return userId;
        }else{
            return userType+"-"+userId;
        }
    }

}
